﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bainx.WPF.Extend
{
    /// <summary>
    /// 控件定位类
    /// </summary>
    public class LTWHXY
    {
        private double left = 0;
        private double top = 0;
        private double width = 0;
        private double height = 0;
        private double x = 0;
        private double y = 0;
        /// <summary>
        /// 获取或设置一个控件的左边距
        /// </summary>
        public double Left
        {
            get { return left; }
            set { left = value; }
        }
        /// <summary>
        /// 获取或设置一个控件的上边距
        /// </summary>
        public double Top
        {
            get { return top; }
            set { top = value; }
        }
        /// <summary>
        /// 获取或设置一个控件的宽度
        /// </summary>
        public double Width
        {
            get { return width; }
            set { width = value; }
        }
        /// <summary>
        /// 获取或设置一个控件的高度
        /// </summary>
        public double Height
        {
            get { return height; }
            set { height = value; }
        }
        /// <summary>
        /// 获取或设置一个控件相对于屏幕的位置上的X位置
        /// </summary>
        public double X
        {
            get { return x; }
            set { x = value; }
        }
        /// <summary>
        /// 获取或设置一个控件相对于屏幕的位置上的Y位置
        /// </summary>
        public double Y
        {
            get { return y; }
            set { y = value; }
        }
        /// <summary>
        /// 实例化一个坐标定位
        /// </summary>
        public LTWHXY()
        { }
        /// <summary>
        /// 实例化一个坐标定位
        /// </summary>
        /// <param name="option"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        public LTWHXY(String option, double a, double b)
        {
            if (option.Equals("LT"))
            {
                this.left = a;
                this.top = b;
            }
            else if (option.Equals("WH"))
            {
                this.width = a;
                this.height = b;
            }
            else   //(option.Equals("XY"))
            {
                this.x = a;
                this.y = b;
            }
        }
        /// <summary>
        /// 实例化一个坐标定位
        /// </summary>
        /// <param name="option"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="c"></param>
        /// <param name="d"></param>
        public LTWHXY(String option, double a, double b, double c, double d)
        {
            if (option.Equals("LTWH"))
            {
                this.left = a;
                this.top = b;
                this.width = c;
                this.height = d;
            }
            else if (option.Equals("LTXY"))
            {
                this.left = a;
                this.top = b;
                this.x = c;
                this.y = d;
            }
            else //if(option.Equals("WHXY"))
            {
                this.width = a;
                this.height = b;
                this.x = c;
                this.y = d;
            }
        }
        /// <summary>
        /// 实例化一个坐标定位
        /// </summary>
        /// <param name="left"></param>
        /// <param name="top"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public LTWHXY(double left, double top, double width, double height, double x, double y)
        {
            this.left = left;
            this.top = top;
            this.width = width;
            this.height = height;
            this.x = x;
            this.y = y;
        }


    }
}
